<template>
  <div>
    <van-cell title="搜索历史">
      <van-icon name="delete-o" @click="isDel=true" v-if="!isDel"></van-icon>
      <div v-else>
        <span @click="$store.commit('SET_HISTORY',[])">全部删除</span> &nbsp;
        <span @click="isDel=false">完成</span>
      </div>
    </van-cell>
    <van-cell :title="item" v-for="item in $store.state.histories" :key="item" @click="$emit('updata-keywords',item)">
      <van-icon name="close" v-if="isDel" @click="$store.state.histories.filter(i=>i!==item)"></van-icon>
    </van-cell>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isDel: false
    }
  }
}
</script>

<style>

</style>